/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-11-29 10:51:47
 * @LastEditors: huangtianyang
 * @LastEditTime: 2024-04-24 08:59:22
 * @FilePath: \cxl-driving-training\src\apis\coach\index.ts
 */
import axios from '../../axios/index'

export interface coachListInterface {
    current?: number
    size?: number
    disable?: number //0.可用；1.禁用
    phone?: string
    name?: string
    sex?: number //	性别（1.男；2.女）
    teachAge?: number
    schoolId?: string
}

export const coachList = (params: coachListInterface) => {
    return axios({
        method: 'get',
        url: '/api/system/schoolCoach/manage/pageList',
        params
    })
}

export interface coachOperationInterface {
    disable?: boolean
    headPic?: string
    id?: string
    introduce?: string
    name?: string
    phone?: string
    schoolId?: string
    sex?: number
    teachAge?: number
}

export const coachAdd = (data: coachOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/schoolCoach/manage/add',
        data
    })
}

export const coachEdit = (data: coachOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/schoolCoach/manage/edit',
        data
    })
}

export const coachDetailed = (id: string) => {
    return axios({
        method: 'get',
        url: '/api/system/schoolCoach/manage/detailById',
        params: { id }
    })
}

//导入科目三场地
export const importCoach = (file: File) => {
    const fileFormData = new FormData()
    fileFormData.append('file', file)
    return axios({
        method: 'post',
        url: '/api/system/schoolCoach/manage/importExcelList',
        data: fileFormData
    })
}
/**
 *
 * @param disable 	0.可用；1.禁用
 * @param id
 * @returns
 */
export const coachDisable = (disable: number, id: string) => {
    return axios({
        method: 'post',
        url: '/api/system/schoolCoach/manage/updateDisable',
        data: { disable, id }
    })
}
